package com.dw.dwdzcommerce.view.operate;

import com.dw.dwdzcommerce.R;
import com.dw.dwdzcommerce.base.activity.BaseActivity;
import com.dw.dwdzcommerce.view.mainContent.mainActionBar.MainContentActionBarFragment.OnMainContentActionBarClickListener;
//import com.dw.dwdzcommerce.test.TestMapActivity;
//import com.dw.dwdzcommerce.view.map.MapActivity;
import com.dw.dwdzcommerce.view.operate.OperateTabLayout.OnTabClickListener;
import com.dw.dwdzcommerce.view.search.SearchActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class OperateActivity extends BaseActivity implements OnTabClickListener, OnMainContentActionBarClickListener {

	private OperateContentLayout mContentLayout;
	private OperateActionBarLayout actionBarLayout;

	@Override
	protected void inCreate(Bundle savedInstanceState) {
		OperateTabLayout layout = new OperateTabLayout();
		layout.initModule(this);
		layout.setmOnTabClickListener(this);
		mContentLayout = new OperateContentLayout();
		mContentLayout.initModule(this);
		actionBarLayout = new OperateActionBarLayout();
		actionBarLayout.initModule(this, this);
		mContentLayout.selectMainFragment();
		actionBarLayout.selectMainActionBarFragment();
	}

	@Override
	protected int getLayoutId() {
		return R.layout.activity_operate;
	}

	@Override
	public void onMainClick(View mainBtn) {
		Button b = (Button) mainBtn;
		toast(this, b.getText().toString());
		mContentLayout.selectMainFragment();
		actionBarLayout.selectMainActionBarFragment();
	}

	@Override
	public void onMapClick(View mapBtn) {
		Button b = (Button) mapBtn;
		// toast(this, b.getText().toString());
		// mContentLayout.selectMapFragment();
		 actionBarLayout.selectMapActionBarFragment();
//		 startActivity(new Intent(OperateActivity.this, MapActivity.class));
	}

	@Override
	public void onMineClick(View mineBtn) {
		Button b = (Button) mineBtn;
		toast(this, b.getText().toString());
		mContentLayout.selectMineFragment();
		actionBarLayout.selectMineActionBarFragment();
	}

	@Override
	public void onSearch(View view) {
		startActivity(getDefaultIntent(this, SearchActivity.class));
	}	

	@Override
	public void onTypes(String type, int pos) {
		Toast.makeText(this, type + " pos=" + pos, Toast.LENGTH_LONG).show();
	}

}
